package com.csxh.bookstore.bean;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

public class Order implements Serializable{

	private Integer id;
	
	//private Integer userId;
	
	private User user;
	
	
	private Set<OrderDetail> detailSet=new HashSet<OrderDetail>();

	public void add(OrderDetail detail) {
		this.detailSet.add(detail);
		detail.setOrder(this);
	}
	
	public void setDetailSet(Set<OrderDetail> detailSet) {
		this.detailSet = detailSet;
	}
	
	public Set<OrderDetail> getDetailSet() {
		return detailSet;
	}
	
	
	private String numbers;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getUserId() {
		return user.getId();
	}
	
	public void setUser(User user) {
		this.user = user;
	}
	
	public User getUser() {
		return user;
	}
	

	public void setUserId(Integer userId) {
		this.user.setId(userId);
	}

	public String getNumbers() {
		return numbers;
	}

	public void setNumbers(String numbers) {
		this.numbers = numbers;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Order other = (Order) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	
}
